import request from '../request'
import globalConfig from "../config";
import {praseStrEmpty} from '@/common/utils'

// 用户登录
export function requestLogin(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.login}`,
        method: 'post',
        params: data
    })
}
export function requestLogout(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.logout}`,
        method: 'post',
        data: data
    })
}

// 查询用户列表
export function getUserListPage(params) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.getUserList}`,
        method: 'get',
        params: params
    })
}
// 查询当前用户
export function getCurrentUser(params) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.getCurrentUser}`,
        method: 'get',
        params: params
    })
}

// 批量删除用户
export function batchRemoveUser(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.batchRemove}`,
        method: 'post',
        data: data
    })
}

// 新增用户
export function addUser(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.addUser}`,
        method: 'post',
        data: data
    })
}

// 更新用户信息
export function editUser(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.editUser}`,
        method: 'post',
        params: data
    })
}
// 更新用户信息
export function getAliToken(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.oss.getAliToken}`,
        method: 'get',
        params: data
    })
}

// 删除用户
export function delUser(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.user.delUser}`,
        method: 'post',
        data: data
    })
}

// 获取用户菜单
export function nav(data) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.sysMenu.menuNav}`,
        method: 'get',
        params: data
    })
}

